﻿using System;
using System.Collections.Generic;
using Sinacor.Infra.UI.Common;
using Sinacor.UI.Bovespa.Contabil.Communication.Bovespa.Ordens.Negocio;

namespace Sinacor.UI.Bovespa.Contabil.Communication.Translator.DataContractToModel
{
    /// <summary>
    /// Translator.DataContractToModel Class - Negocio
    /// </summary>
    public class Negocio
    {
        #region ToBolsa

        public Model.Bolsa ToBolsa(BolsaResponse from)
        {
            if (from == null) return null;

            return new Model.Bolsa
            {
                Codigo = from.Codigo,
                Descricao = from.Descricao
            };
        }

        public ModelCollection<Model.Bolsa> ToBolsa(List<BolsaResponse> responseList)
        {
            if (responseList == null) return null;

            ModelCollection<Model.Bolsa> model = new ModelCollection<Model.Bolsa>();

            foreach (BolsaResponse item in responseList)
            {
                model.Add(new Model.Bolsa
                {
                    Codigo = item.Codigo,
                    Descricao = item.Descricao
                });
            }
            return model;
        }

        #endregion
    }
}
